﻿<UserControl x:Class="ScoreMS.Controls.NumericUpDown"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="30" d:DesignWidth="90"
             Height="30" Width="90"
             xmlns:es="clr-namespace:Microsoft.Expression.Shapes;assembly=Microsoft.Expression.Drawing"
             xmlns:local="clr-namespace:ScoreMS.Controls">
    <!--Width="200" Height="23" MaxHeight="23" MinHeight="23" MinWidth="50"-->

    <UserControl.Resources>
        <Style x:Key="ArrowButtonStyle" BasedOn="{x:Null}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Rectangle Stroke="#FFA0A0A0" d:LayoutOverrides="GridBox" RadiusX="1" RadiusY="1" Width="30" Height="30">
                                <Rectangle.Fill>
                                    <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
                                        <GradientStop Color="#FFDCDCDC" Offset="0"/>
                                        <GradientStop Color="#FFDCDCDC" Offset="0.991"/>
                                        <GradientStop Color="#FFC8C8C8" Offset="0.496"/>
                                        <GradientStop Color="#FFDCDCDC" Offset="0.549"/>
                                    </LinearGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>
                            <es:RegularPolygon Fill="#FF5A5A5A" Height="14.022" InnerRadius="1" PointCount="3" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" Width="18.904" RenderTransformOrigin="0.5,0.5">
                                <es:RegularPolygon.RenderTransform>
                                    <RotateTransform Angle="-90" />
                                </es:RegularPolygon.RenderTransform>
                            </es:RegularPolygon>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True"/>
                            <Trigger Property="IsDefaulted" Value="True"/>
                            <Trigger Property="IsMouseOver" Value="True"/>
                            <Trigger Property="IsPressed" Value="True"/>
                            <Trigger Property="IsEnabled" Value="False"/>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot">
        <Border x:Name="ControlBorder" CornerRadius="2,2,2,2" BorderThickness="0,0,0,0" BorderBrush="#FFA0A0A0" Background="#FFFFFFFF">
            <StackPanel Orientation="Horizontal">
                <Button HorizontalAlignment="Left" Style="{DynamicResource ArrowButtonStyle}" Width="30" x:Name="UpButton" Click="DownButton_Click" Height="30" />
                <TextBox Text="{Binding Value}" IsReadOnly="True" BorderBrush="{x:Null}" FontSize="18" TextAlignment="Center" MinWidth="30" BorderThickness="0,0,0,0" VerticalContentAlignment="Center" x:Name="ValueText" LostFocus="ValueText_LostFocus" />
                <Button HorizontalAlignment="Right" Style="{DynamicResource ArrowButtonStyle}" VerticalAlignment="Top" Width="30" Height="30" RenderTransformOrigin="0.5,0.5" x:Name="DownButton" Click="UpButton_Click">
                    <Button.RenderTransform>
                        <TransformGroup>
                            <RotateTransform Angle="180"/>
                        </TransformGroup>
                    </Button.RenderTransform>
                </Button>
            </StackPanel>
        </Border>
    </Grid>
</UserControl>